package com.service.impl;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.common.PageUtils;
import com.dao.TransferRecdDao;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.model.ReponseDto;
import com.service.IDataService;

@Service
public class DataServiceImpl implements IDataService {

    @Autowired
    private TransferRecdDao transferRecdDao;

    @Override
    public ReponseDto<PageInfo> list(String userName, String coinSymbol, String pageNo,Integer pageSize) {
        if(null == pageSize) {
            pageSize = PageUtils.pageSize;
        }
        Page page = PageHelper.startPage(PageUtils.initPage(pageNo), pageSize);
        Map<String, Object> parMap = new HashMap<>();
        parMap.put("userName", userName);
        parMap.put("coinSymbol", coinSymbol);
        transferRecdDao.get(parMap);
        PageInfo info = new PageInfo<>(page.getResult());
        return new ReponseDto<>(info);
    }

}
